unit uPriClass;

interface

uses
  Classes {$IFDEF MSWINDOWS} , Windows {$ENDIF},
  SysUtils,DateUtils;

type
  TTokenManager=class
  private
    FExpires: Integer;
    FToken: String;
  protected
    FTime:TDateTime;
  public
    constructor Create;
    procedure SetToken(sToken:String;iExpires:Integer);
    function CheckExpire:Boolean;
    property Token:String read FToken;
    property Expires:Integer read FExpires;
  end;
implementation

{ TTokenManager }

function TTokenManager.CheckExpire: Boolean;
begin
  Result:=(IncSecond(FTime,FExpires)>Now);
end;

constructor TTokenManager.Create;
begin
  FTime:=0;
  FExpires:=7000;
end;

procedure TTokenManager.SetToken(sToken: String; iExpires: Integer);
begin
  FToken:=sToken;
  FExpires:=iExpires;
  FTime:=Now;
end;

end.
